<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.augmentum.login.Constants"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="com.augmentum.login.model.Exam"%>
<%@ page import="com.augmentum.login.util.Prop"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String basePath = request.getContextPath();
   String staticPath = Prop.get(Constants.STATIC_PATH);
   List list = (List) request.getAttribute(Constants.EXAM_LIST);
%>
<script type="text/javascript">
    $(document).ready(function(){
        $("input[name='selectedId']").click(function() {
            if(!this.checked) {
                $("#examIds").attr("checked" ,false);
            }
        });
    });
</script>
<div id="bottomId" class="common border-style">
  <div class="float-left" style="width:20%">
    <div class="common common-width float-left">
      <div class="common common-width">
        <span class="layout-center style-span"></span>
      </div>
      <div class="common common-width">
        <span onclick="getClick('<%=basePath%>/page/exam/search')"
          class="cursor bg-color01 color-style03 font-style03 color-style01 layout-center style-span">ExamList</span>
      </div>
      <div class="common common-width">
        <span onclick="getClick('<%=basePath%>/page/exam/createPage')"
          class="cursor font-style03 color-style01 layout-center style-span">Create Exam</span>
        <hr class="hr-style color-style01" />
      </div>
      <div class="common common-width">
        <span onclick="getClick('<%=basePath%>/page/exam/draftSearch')"
          class="cursor font-style03 color-style01 layout-center style-span">Draft List</span>
        <hr class="hr-style color-style01" />
      </div>
    </div>
  </div>
  <hr class="float-left common-height" style="widht:1%;color:#9D9D9D" />
  <div id="iframeId" style="width:79%;" class="common common-height float-left">
    <div class="common">
      <div style="width:100%;" class="common common-height float-left">
        <div class="layout-div" style="height:42px">
          <form id="form01" class="common-length" name="form01" action="<%=basePath%>/page/exam/search" method="post">
            <div id="searchId" class="float-right" style="margin:10px">
              <img style="cursor:pointer" alt="search" onclick="javascript:document.form01.submit();" class="common float-left" src="<%=staticPath%>/images/ICN_Search_15x20.png" />
            </div>
            <div id="examId" class="font-style03 float-right Div-style" style="height:27px;width:120px;margin-left:30px;margin-top:10px;margin-bottom:5px">
              <input id="exam_id" name="examName" type="text" class="float-left common common-height" placeholder="Please input name!" />
            </div>
            <div id="descriptionId" class="font-style03 float-right Div-style" style="height:27px;width:140px;margin-top:10px;margin-bottom:5px">
              <input id="description_id" name="description" type="text" class="float-left common common-height" placeholder="Please input description!" />
            </div>
          </form>
        </div>
        <div class="layout-div radius5" style="border:1px #2E4358 solid">
          <div class="common common-width common-height">
            <div class="header color-style04 font-style03" style="height:25px;padding:10px;">
              <div class="head-width common common-border float-left layout-center" style="width: 3%;">ID</div>
              <div class="common float-left common-border layout-center" style="width: 10%;">name</div>
              <div class="common float-left common-border layout-center" style="width: 13%;">Description</div>
              <div class="common float-left common-border layout-center" style="width: 12%;">Question Count</div>
              <div class="common float-left common-border layout-center" style="width: 12%;">Question Score</div>
              <div class="common float-left common-border layout-center" style="width: 10%;">
                Total Score
                <img id="orderId" style="cursor:pointer" onclick="javascript:document.form02.submit();" alt="increate" src="<%=staticPath%>/images/ICN_Increase_10x15.png" />
                <form class="common" name="form02" action="<%=basePath%>/page/exam/search" method="post">
                  <input type="hidden" name="description" value="<%=request.getAttribute("description")%>" />
                  <input type="hidden" name="examName" value="<%=request.getAttribute("examName")%>" />
                  <input id="orderValueId" type="hidden" name="order" value="total_score ASC" />
                </form>
              </div>
              <div class="common float-left common-border layout-center" style="width: 8%;">Duration</div>
              <div class="common float-left common-border layout-center" style="width: 10%;">Begin Time</div>
              <div class="common float-left common-border layout-center" style="width: 10%;">Pass Criteria</div>
              <div class="head-width common common-border float-left layout-center" style="width: 10%;">
                Edit
                <span>
                  <input id="examIds" style="cursor:pointer" onclick="selectedAll(this, 'selectedId')" type="checkbox" name="examIds" />
                </span>
              </div>
            </div>
            <hr style="border:1px #2E4358 solid;margin:0px;padding:0" class="common-width" />
            <div class="content-list common-width float-left radius5" style="border:1px #2E4358 solid">
              <%
                  int num = 1;
                  if (list.size() > 0) {
                      List<Exam> exams = list;
                      Exam q = null;
                      for (Exam o : exams) {
                          q = o;
              %>
              <div class="layout-center common common-width float-left" style="height:25px;border-bottom:1px #2E4358 solid;">
                <span class="float-left common common-height" style="width:3%;height:20px;color:#0A0A0A;overflow:hidden"><%=num++%></span>
                <span class="float-left zxx_text_overflow color-style04 common common-height font-style06" style="width:10%;height:20px;overflow:hidden" ><%=q.getName()%></span>
                <span class="float-left zxx_text_overflow color-style05 common common-height font-style06 float-left" style="width:13%;height:20px;overflow:hidden"><%=q.getDescription()%></span>
                <span class="float-left color-style05 common common-height font-style06 float-left" style="width:12%;height:20px;overflow:hidden"><%=q.getQuestionCount()%></span>
                <span class="float-left color-style05 common common-height font-style06 float-left" style="width:12%;height:20px;overflow:hidden"><%=q.getQuestionScore()%></span>
                <span class="float-left color-style04 common common-height font-style06" style="width:10%;height:20px;overflow:hidden" ><%=q.getTotalScore()%></span>
                <span class="float-left color-style04 common common-height font-style06" style="width:8%;height:20px;overflow:hidden" ><%=q.getDuration()%></span>
                <span class="float-left color-style04 common common-height font-style06" style="width:12%;height:20px;overflow:hidden" ><%=q.getBeginTime()%></span>
                <span class="float-left color-style04 common common-height font-style06" style="width:10%;height:20px;overflow:hidden" ><%=q.getCriteria()%></span>
                <span class="float-left common common-height" style="width:5%;height:20px;overflow:hidden" >&nbsp;&nbsp;&nbsp;
                  <img style="cursor:pointer" onclick="edit('<%=basePath%>/page/exam/editPage','id=<%=q.getId()%>');" src="<%=staticPath%>/images/ICN_Edit_15x15.png.png" /></span>
                <span class="float-left common common-height" style="width:5%;height:20px;overflow:hidden">
                  <input style="cursor:pointer" class="float-left" value="<%=q.getId()%>" type="checkBox" id="selectedId" name="selectedId" />
                </span>
              </div>
              <%
                     }
                  }
              %>
            </div>
          </div>
          <div style="clean: both"></div>
          <jsp:include page="exam-page.jsp" />
        </div>
      </div>
    </div>
  </div>
  
  <script type="text/javascript">
      $("#bottomId").height($("body").height()-$("#topId").height());
  </script>
  <div style="clean:both"></div>
</div>